```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java对象模型全解析 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f9fafb;
            color: #1f2937;
        }
        h1, h2, h3, h4, h5 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
        }
        .code-block {
            background-color: #1e293b;
            color: #f8fafc;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 0.8;
            margin: 0.15em 0.1em 0 0;
            font-weight: 700;
            color: #2563eb;
        }
        .hover-scale {
            transition: transform 0.3s ease;
        }
        .hover-scale:hover {
            transform: translateY(-2px);
        }
        .border-accent {
            border-left: 4px solid #2563eb;
        }
        .mermaid {
            background-color: #f3f4f6;
            padding: 1.5rem;
            border-radius: 0.5rem;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-6">
        <div class="max-w-5xl mx-auto text-center">
            <div class="flex justify-center mb-6">
                <div class="bg-white/20 rounded-full p-3">
                    <i class="fas fa-code text-3xl"></i>
                </div>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-4">Java对象模型全解析</h1>
            <p class="text-xl md:text-2xl opacity-90 mb-8">从PO到DTO，揭秘Java企业开发中的对象模型奥秘</p>
            <div class="flex justify-center space-x-4">
                <span class="bg-white/20 px-4 py-1 rounded-full text-sm">Java</span>
                <span class="bg-white/20 px-4 py-1 rounded-full text-sm">设计模式</span>
                <span class="bg-white/20 px-4 py-1 rounded-full text-sm">企业开发</span>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-5xl mx-auto px-6 py-12">
        <!-- Author & Meta -->
        <div class="flex items-center mb-10">
            <div class="w-12 h-12 rounded-full bg-gray-200 overflow-hidden mr-4">
                <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1749449046924-82bc7fbd-3b69-476a-882d-dbc70df707af.png" alt="作者头像" class="w-full h-full object-cover">
            </div>
            <div>
                <p class="font-medium text-gray-700">技术小馆</p>
                <p class="text-sm text-gray-500">发布于 2023年5月 · 10分钟阅读</p>
            </div>
        </div>

        <!-- Article Content -->
        <article class="prose prose-lg max-w-none">
            <p class="text-xl text-gray-700 mb-8 drop-cap">作为一名 Java 开发者，你是否曾在代码评审或技术面试中被问到："PO、DTO、VO 有什么区别？"然后瞬间大脑一片空白？别担心，你不是一个人。Java 世界中的这些"O"们确实让人眼花缭乱。它们就像是一个个穿着相似制服的士兵，乍一看几乎一模一样，但实际上各自担负着不同的职责。</p>

            <!-- Featured Image -->
            <div class="mb-12 rounded-xl overflow-hidden shadow-lg hover-scale">
                <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1749449046924-82bc7fbd-3b69-476a-882d-dbc70df707af.png" alt="Java对象模型图解" class="w-full h-auto">
            </div>

            <div class="border-accent bg-white p-6 rounded-lg shadow-sm mb-10">
                <h3 class="text-xl font-semibold mb-4 flex items-center">
                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                    关键要点
                </h3>
                <ul class="space-y-2">
                    <li class="flex items-start">
                        <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                        <span>PO是数据库的"大使"，忠实反映表结构</span>
                    </li>
                    <li class="flex items-start">
                        <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                        <span>DTO是层间"信使"，专注数据传输</span>
                    </li>
                    <li class="flex items-start">
                        <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                        <span>VO是前端"化妆师"，优化数据展示</span>
                    </li>
                    <li class="flex items-start">
                        <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                        <span>BO是业务"专家"，封装业务逻辑</span>
                    </li>
                </ul>
            </div>

            <!-- Section 1 -->
            <section class="mb-16">
                <h2 class="text-3xl font-bold mb-6 text-gray-800 border-b pb-2">1. Java对象模型的起源与演变</h2>
                
                <h3 class="text-2xl font-semibold mt-8 mb-4 text-gray-700">为什么Java需要这么多不同类型的对象？</h3>
                <p class="mb-6">还记得你第一次接触企业级 Java 项目时的感受吗？面对满屏的 UserPO、UserDTO、UserVO，你可能会想："为什么不能只用一个 User 类就搞定呢？"</p>
                <p class="mb-6">实际上，这些不同的对象模型是为了解决软件工程中的一个核心问题：<strong class="text-blue-600">关注点分离</strong>。随着应用规模的扩大，如果所有功能都挤在一个对象里，就像把衣服、裤子、袜子都塞进同一个抽屉，不仅找东西困难，还容易互相影响。</p>
                
                <h3 class="text-2xl font-semibold mt-8 mb-4 text-gray-700">从 MVC 到多层架构</h3>
                <p class="mb-6">Java 对象模型的演变与架构模式的发展密不可分。最初的 MVC 模式将应用分为模型(Model)、视图(View)和控制器(Controller)。随着应用复杂度提高，这种简单的分层已不足以应对挑战。</p>
                <p class="mb-6">于是，多层架构应运而生：</p>
                
                <div class="code-block p-4 mb-6">
                    <code class="text-white">表现层 → 业务层 → 持久层 → 数据库</code>
                </div>
                
                <p>每一层都有其特定的职责和关注点，自然也需要专门的对象模型来承载数据。</p>
            </section>

            <!-- Section 2 -->
            <section class="mb-16">
                <h2 class="text-3xl font-bold mb-6 text-gray-800 border-b pb-2">2. 常见的Java对象模型</h2>
                
                <!-- PO Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 hover-scale">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-blue-100 p-2 rounded-lg mr-4">
                                <i class="fas fa-database text-blue-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold text-gray-800">PO (Persistent Object)</h3>
                        </div>
                        <p class="text-gray-700 mb-4">PO 是与数据库表结构一一对应的对象，是 ORM（对象关系映射）的基础。</p>
                        
                        <div class="code-block p-4">
                            <pre><code class="language-java">@Entity
@Table(name = "users")
public class UserPO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Column(name = "username", length = 50, nullable = false)
    private String username;
    
    @Column(name = "password", length = 100, nullable = false)
    private String password;
    
    @Column(name = "email", length = 100)
    private String email;
    
    @Column(name = "created_at")
    private Date createdAt;
    
    // getter 和 setter 方法
}</code></pre>
                        </div>
                        <p class="text-gray-600 mt-4">PO 就像是数据库的"大使"，它忠实地反映了数据库的结构，包括各种约束和关系。</p>
                    </div>
                </div>
                
                <!-- DTO Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 hover-scale">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 p-2 rounded-lg mr-4">
                                <i class="fas fa-exchange-alt text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-semibold text-gray-800">DTO (Data Transfer Object)</h3>
                        </div>
                        <p class="text-gray-700 mb-4">DTO 专注于在不同层之间传输数据，通常包含多个来源的数据。</p>
                        
                        <div class="code-block p-4">
                            <pre><code class="language-java">public class UserRegistrationDTO {
    private String username;
    private String password;
    private String email;
    private String captchaCode;
    private boolean agreeToTerms;
    
    // getter 和 setter 方法
}</code></pre>
                        </div>
                        <p class="text-gray-600 mt-4">DTO 就像是层与层之间的"信使"，它携带着必要的信息，但不包含业务逻辑。</p>
                    </div>
                </div>
                
                <!-- Mermaid Diagram -->
                <div class="mermaid mb-8">
                    graph TD
                        A[PO] -->|数据库交互| B(持久层)
                        B -->|转换为| C[DTO]
                        C -->|传输| D(业务层)
                        D -->|处理| E[BO]
                        E -->|转换为| F[VO]
                        F -->|展示| G(表现层)
                </div>
                
                <p class="text-gray-700 mb-6">通过合理设计和使用各种对象模型，我们可以构建出更加健壮、可维护的Java应用程序。虽然初学者可能会觉得这些"O"们令人困惑，但随着经验的积累，你会发现它们各自的价值和适用场景。</p>
            </section>

            <!-- Section 3 -->
            <section class="mb-16">
                <h2 class="text-3xl font-bold mb-6 text-gray-800 border-b pb-2">3. 对象模型的实战应用</h2>
                
                <h3 class="text-2xl font-semibold mt-8 mb-4 text-gray-700">电商系统中的对象模型设计案例</h3>
                <p class="mb-6">让我们以一个商品模块为例，看看不同对象模型如何协同工作：</p>
                
                <div class="grid md:grid-cols-2 gap-6 mb-8">
                    <!-- PO Code -->
                    <div class="bg-white rounded-lg shadow-sm p-6 hover-scale">
                        <h4 class="font-semibold text-lg mb-3 flex items-center">
                            <i class="fas fa-database text-blue-500 mr-2"></i>
                            ProductPO
                        </h4>
                        <div class="code-block p-3 text-sm">
                            <pre><code class="language-java">@Entity
@Table(name = "products")
public class ProductPO {
    @Id
    private Long id;
    private String name;
    private String description;
    private BigDecimal price;
    private Integer stock;
    private Date createdAt;
    // getters & setters
}</code></pre>
                        </div>
                    </div>
                    
                    <!-- BO Code -->
                    <div class="bg-white rounded-lg shadow-sm p-6 hover-scale">
                        <h4 class="font-semibold text-lg mb-3 flex items-center">
                            <i class="fas fa-cogs text-green-500 mr-2"></i>
                            ProductBO
                        </h4>
                        <div class="code-block p-3 text-sm">
                            <pre><code class="language-java">public class ProductBO {
    private ProductPO product;
    private List&lt;CategoryPO&gt; categories;
    
    public boolean isOnSale() {
        return product.getStock() > 0;
    }
    
    public BigDecimal getDiscountPrice(UserPO user) {
        // 根据用户等级计算折扣
    }
}</code></pre>
                        </div>
                    </div>
                    
                    <!-- DTO Code -->
                    <div class="bg-white rounded-lg shadow-sm p-6 hover-scale">
                        <h4 class="font-semibold text-lg mb-3 flex items-center">
                            <i class="fas fa-exchange-alt text-purple-500 mr-2"></i>
                            ProductDTO
                        </h4>
                        <div class="code-block p-3 text-sm">
                            <pre><code class="language-java">public class ProductDTO {
    private Long id;
    private String name;
    private String description;
    private BigDecimal price;
    private Integer stock;
    private List&lt;String&gt; categoryNames;
    // getters & setters
}</code></pre>
                        </div>
                    </div>
                    
                    <!-- VO Code -->
                    <div class="bg-white rounded-lg shadow-sm p-6 hover-scale">
                        <h4 class="font-semibold text-lg mb-3 flex items-center">
                            <i class="fas fa-eye text-red-500 mr-2"></i>
                            ProductVO
                        </h4>
                        <div class="code-block p-3 text-sm">
                            <pre><code class="language-java">public class ProductVO {
    private Long id;
    private String name;
    private String formattedPrice;
    private String stockStatus;
    private List&lt;String&gt; categoryNames;
    private String imageUrl;
    // getters & setters
}</code></pre>
                        </div>
                    </div>
                </div>
                
                <h3 class="text-2xl font-semibold mt-8 mb-4 text-gray-700">MapStruct 与 ModelMapper</h3>
                <p class="mb-6">MapStruct 和 ModelMapper 都是 Java 中用于对象映射（Object Mapping）的工具库，它们可以帮助开发者简化不同对象模型之间的转换工作。</p>
                
                <!-- Comparison Table -->
                <div class="bg-white rounded-lg shadow-sm overflow-hidden mb-8">
                    <table class="min-w-full divide-y divide-gray-200">
                        <thead class="bg-gray-50">
                            <tr>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">特性</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">MapStruct</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ModelMapper</th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-gray-200">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">处理方式</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">编译时代码生成</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">运行时反射</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">性能</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">非常高</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">较低（反射开销）</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">调试难度</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">简单（可读代码）</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">复杂（反射调用）</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                
                <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mb-8">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="fas fa-lightbulb text-blue-500"></i>
                        </div>
                        <div class="ml-3">
                            <h3 class="text-sm font-medium text-blue-800">选择建议</h3>
                            <div class="mt-2 text-sm text-blue-700">
                                <p>• 如果你关注<strong>性能</strong>和<strong>类型安全</strong>，选择 MapStruct</p>
                                <p>• 如果你需要<strong>快速开发</strong>和<strong>动态映射</strong>，选择 ModelMapper</p>
                                <p>• 大型企业级应用通常更倾向于使用 MapStruct</p>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            <!-- Section 4 -->
            <section class="mb-16">
                <h2 class="text-3xl font-bold mb-6 text-gray-800 border-b pb-2">4. 面试官最爱问的对象模型问题</h2>
                
                <!-- FAQ Accordion -->
                <div class="space-y-4">
                    <div class="bg-white rounded-lg shadow-sm overflow-hidden">
                        <button class="w-full px-6 py-4 text-left flex items-center justify-between focus:outline-none">
                            <span class="font-semibold text-lg">"请解释 PO、DTO、VO 的区别和使用场景"</span>
                            <i class="fas fa-chevron-down transition-transform"></i>
                        </button>
                        <div class="px-6 pb-4">
                            <ul class="list-disc pl-5 space-y-2">
                                <li><strong>PO</strong>：与数据库表结构对应，用于持久化层，包含完整的数据库字段</li>
                                <li><strong>DTO</strong>：用于层间数据传输，只包含必要的数据，不含业务逻辑</li>
                                <li><strong>VO</strong>：面向前端展示，关注数据如何被呈现，可能包含格式化后的数据</li>
                            </ul>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-lg shadow-sm overflow-hidden">
                        <button class="w-full px-6 py-4 text-left flex items-center justify-between focus:outline-none">
                            <span class="font-semibold text-lg">"为什么需要 DTO，直接使用 Entity 不行吗？"</span>
                            <i class="fas fa-chevron-down transition-transform"></i>
                        </button>
                        <div class="px-6 pb-4">
                            <p class="mb-3">直接使用 Entity（PO）会导致以下问题：</p>
                            <ul class="list-disc pl-5 space-y-2">
                                <li><strong>耦合问题</strong>：数据库结构变更会直接影响接口</li>
                                <li><strong>安全问题</strong>：可能暴露敏感字段（如密码哈希）</li>
                                <li><strong>性能问题</strong>：可能包含不必要的大量数据</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </section>
        </article>

        <!-- Call to Action -->
        <div class="bg-blue-600 text-white rounded-xl p-8 text-center mb-12">
            <h3 class="text-2xl font-bold mb-3">想深入了解Java开发最佳实践？</h3>
            <p class="mb-6 opacity-90">订阅我们的技术周刊，获取更多专业内容</p>
            <div class="max-w-md mx-auto flex">
                <input type="email" placeholder="你的邮箱地址" class="flex-grow px-4 py-3 rounded-l-lg focus:outline-none text-gray-900">
                <button class="bg-blue-800 hover:bg-blue-900 px-6 py-3 rounded-r-lg font-medium transition-colors">订阅</button>
            </div>
        </div>
    </div>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 简单的折叠功能
        document.querySelectorAll('button').forEach(button => {
            button.addEventListener('click', () => {
                const content = button.nextElementSibling;
                const icon = button.querySelector('i');
                
                content.classList.toggle('hidden');
                icon.classList.toggle('transform');
                icon.classList.toggle('rotate-180');
            });
        });
    </script>
</body>
</html>
```